<template>
<slot :controller="controller" :store="store" :model="model">
    <div :class="classNames">
        <slot name="page_containerContainer" :controller="controller" :store="store" :model="model" >
        <AppStandardContainer 
            name="page_container"
            v-show="store.layoutModelDetails?.page_container?.visible"
            :isMultiContainer="false"
            :layoutModelDetails="store.layoutModelDetails">
            <template #tabpanel1>
                <slot name="tabpanel1TabPanel" :controller="controller" :store="store" :model="model" >
                <AppTabPanel 
                    name="tabpanel1"
                    v-show="store.layoutModelDetails?.tabpanel1?.visible"
                    :layoutModelDetails="store.layoutModelDetails">
                        <template #tabpage1>
                            <slot name="tabpage1TabPage" :controller="controller" :store="store" :model="model" >
                            <AppTabPage 
                                name="tabpage1"
                                v-show="store.layoutModelDetails?.tabpage1?.visible"
                                :layoutModelDetails="store.layoutModelDetails">
                                    <template #container_grid1>
                                         <slot name="container_grid1Container" :controller="controller" :store="store" :model="model" >
                                         <AppSimpleFlexContainer 
                                             name="container_grid1"
                                             :layoutModelDetails="store.layoutModelDetails">
                                             <template #container1>
                                                 <slot name="container1Container" :controller="controller" :store="store" :model="model" >
                                                 <AppStandardContainer 
                                                     name="container1"
                                                     v-show="store.layoutModelDetails?.container1?.visible"
                                                     :isMultiContainer="false"
                                                     :layoutModelDetails="store.layoutModelDetails">
                                                     <template #static_text1>
                                                         <slot name="static_text1" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                                                         <AppPresetText 
                                                             name="static_text1"
                                                             @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                                                             :layoutModelDetails="store.layoutModelDetails" />
                                                         </slot>
                                                     </template>
                                                 </AppStandardContainer>
                                                 </slot>
                                             </template>
                                             <template #container2>
                                                 <slot name="container2Container" :controller="controller" :store="store" :model="model" >
                                                 <AppStandardContainer 
                                                     name="container2"
                                                     v-show="store.layoutModelDetails?.container2?.visible"
                                                     :isMultiContainer="false"
                                                     :layoutModelDetails="store.layoutModelDetails">
                                                 </AppStandardContainer>
                                                 </slot>
                                             </template>
                                             <template #container3>
                                                 <slot name="container3Container" :controller="controller" :store="store" :model="model" >
                                                 <AppStandardContainer 
                                                     name="container3"
                                                     v-show="store.layoutModelDetails?.container3?.visible"
                                                     :isMultiContainer="false"
                                                     :layoutModelDetails="store.layoutModelDetails">
                                                 </AppStandardContainer>
                                                 </slot>
                                             </template>
                                         </AppSimpleFlexContainer>
                                         </slot>
                                    </template>
                            </AppTabPage>
                            </slot>
                        </template>
                        <template #tabpage5>
                            <slot name="tabpage5TabPage" :controller="controller" :store="store" :model="model" >
                            <AppTabPage 
                                name="tabpage5"
                                v-show="store.layoutModelDetails?.tabpage5?.visible"
                                :layoutModelDetails="store.layoutModelDetails">
                                    <template #container5>
                                         <slot name="container5Container" :controller="controller" :store="store" :model="model" >
                                         <AppStandardContainer 
                                             name="container5"
                                             v-show="store.layoutModelDetails?.container5?.visible"
                                             :isMultiContainer="false"
                                             :layoutModelDetails="store.layoutModelDetails">
                                             <template #static_text2>
                                                 <slot name="static_text2" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                                                 <AppPresetText 
                                                     name="static_text2"
                                                     @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                                                     :layoutModelDetails="store.layoutModelDetails" />
                                                 </slot>
                                             </template>
                                         </AppStandardContainer>
                                         </slot>
                                    </template>
                            </AppTabPage>
                            </slot>
                        </template>
                        <template #tabpage6>
                            <slot name="tabpage6TabPage" :controller="controller" :store="store" :model="model" >
                            <AppTabPage 
                                name="tabpage6"
                                v-show="store.layoutModelDetails?.tabpage6?.visible"
                                :layoutModelDetails="store.layoutModelDetails">
                                    <template #container_multidata1>
                                         <slot name="container_multidata1Container" :controller="controller" :store="store" :model="model" >
                                         <AppStandardContainer 
                                             name="container_multidata1"
                                             v-show="store.layoutModelDetails?.container_multidata1?.visible"
                                             :isMultiContainer="true"
                                             :layoutModelDetails="store.layoutModelDetails">
                                             <template #container4="{ data }">
                                                 <slot name="container4Container" :controller="controller" :store="store" :model="model" :index="data.index">
                                                 <AppStandardContainer 
                                                     name="container4"
                                                     :index="data.index"
                                                     v-show="store.layoutModelDetails?.[`container4_${data.index}`]?.visible"
                                                     :isMultiContainer="false"
                                                     :layoutModelDetails="store.layoutModelDetails">
                                                     <template #type>
                                                         <slot name="type" :controller="controller" :store="store" :model="model" :index="data.index" :actions="{ handleComponentAction }">
                                                         <AppPanelField
                                                             name="type"
                                                             :index="data.index"
                                                             :value="store.layoutData[`type_${data.index}`]"
                                                             :layoutModelDetails="store.layoutModelDetails">
                                                             <slot name="typeEditor" :controller="controller" :store="store" :model="model" :index="data.index" :actions="{ handleComponentAction }">
                                                             <AppInput
                                                                 v-bind="{ editorType: 'TEXTBOX', }"
                                                                 type="text"
                                                                 style=""
                                                                 name="type"
                                                                 :isDebounce="true"
                                                                 :disabled="store.layoutModelDetails[`type_${data.index}`]?.disabled ? true : false"
                                                                 :value="store.layoutData[`type_${data.index}`]"
                                                                 @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam, data.index) }"
                                                             />
                                                             </slot>
                                                         </AppPanelField>
                                                         </slot>
                                                     </template>
                                                     <template #container_group2>
                                                         <slot name="container_group2Container" :controller="controller" :store="store" :model="model" :index="data.index">
                                                         <AppStandardContainer 
                                                             name="container_group2"
                                                             :index="data.index"
                                                             v-show="store.layoutModelDetails?.[`container_group2_${data.index}`]?.visible"
                                                             :isMultiContainer="false"
                                                             :layoutModelDetails="store.layoutModelDetails">
                                                             <template #static_text3>
                                                                 <slot name="static_text3" :controller="controller" :store="store" :model="model" :index="data.index" :actions="{ handleComponentAction }">
                                                                 <AppPresetText 
                                                                     name="static_text3"
                                                                     :index="data.index"
                                                                     @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam, data.index) }"
                                                                     :layoutModelDetails="store.layoutModelDetails" />
                                                                 </slot>
                                                             </template>
                                                             <template #static_text9>
                                                                 <slot name="static_text9" :controller="controller" :store="store" :model="model" :index="data.index" :actions="{ handleComponentAction }">
                                                                 <AppPresetText 
                                                                     name="static_text9"
                                                                     :index="data.index"
                                                                     @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam, data.index) }"
                                                                     :layoutModelDetails="store.layoutModelDetails" />
                                                                 </slot>
                                                             </template>
                                                         </AppStandardContainer>
                                                         </slot>
                                                     </template>
                                                 </AppStandardContainer>
                                                 </slot>
                                             </template>
                                         </AppStandardContainer>
                                         </slot>
                                    </template>
                            </AppTabPage>
                            </slot>
                        </template>
                        <template #tabpage7>
                            <slot name="tabpage7TabPage" :controller="controller" :store="store" :model="model" >
                            <AppTabPage 
                                name="tabpage7"
                                v-show="store.layoutModelDetails?.tabpage7?.visible"
                                :layoutModelDetails="store.layoutModelDetails">
                                    <template #container_scroll2>
                                         <slot name="container_scroll2Container" :controller="controller" :store="store" :model="model" >
                                         <AppScrollContainer 
                                             name="container_scroll2"
                                             :layoutModelDetails="store.layoutModelDetails">
                                             <template #container_scroll_main2>
                                                 <slot name="container_scroll_main2Container" :controller="controller" :store="store" :model="model" >
                                                 <AppScrollContainer 
                                                     name="container_scroll_main2"
                                                     :layoutModelDetails="store.layoutModelDetails">
                                                     <template #static_text6>
                                                         <slot name="static_text6" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                                                         <AppPresetText 
                                                             name="static_text6"
                                                             @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                                                             :layoutModelDetails="store.layoutModelDetails" />
                                                         </slot>
                                                     </template>
                                                 </AppScrollContainer>
                                                 </slot>
                                             </template>
                                             <template #container_scroll_header1>
                                                 <slot name="container_scroll_header1Container" :controller="controller" :store="store" :model="model" >
                                                 <AppScrollContainer 
                                                     name="container_scroll_header1"
                                                     :layoutModelDetails="store.layoutModelDetails">
                                                     <template #static_text5>
                                                         <slot name="static_text5" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                                                         <AppPresetText 
                                                             name="static_text5"
                                                             @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                                                             :layoutModelDetails="store.layoutModelDetails" />
                                                         </slot>
                                                     </template>
                                                 </AppScrollContainer>
                                                 </slot>
                                             </template>
                                         </AppScrollContainer>
                                         </slot>
                                    </template>
                            </AppTabPage>
                            </slot>
                        </template>
                        <template #tabpage2>
                            <slot name="tabpage2TabPage" :controller="controller" :store="store" :model="model" >
                            <AppTabPage 
                                name="tabpage2"
                                v-show="store.layoutModelDetails?.tabpage2?.visible"
                                :layoutModelDetails="store.layoutModelDetails">
                                    <template #container_image1>
                                         <slot name="container_image1Container" :controller="controller" :store="store" :model="model" >
                                         <AppStandardContainer 
                                             name="container_image1"
                                             v-show="store.layoutModelDetails?.container_image1?.visible"
                                             :isMultiContainer="false"
                                             :layoutModelDetails="store.layoutModelDetails">
                                         </AppStandardContainer>
                                         </slot>
                                    </template>
                            </AppTabPage>
                            </slot>
                        </template>
                        <template #tabpage3>
                            <slot name="tabpage3TabPage" :controller="controller" :store="store" :model="model" >
                            <AppTabPage 
                                name="tabpage3"
                                v-show="store.layoutModelDetails?.tabpage3?.visible"
                                :layoutModelDetails="store.layoutModelDetails">
                                    <template #nav_pos1>
                                         <slot name="nav_pos1" :controller="controller" :store="store" :model="model" >
                                         <AppNavPos 
                                             name="nav_pos1"
                                             :layoutModelDetails="store.layoutModelDetails"
                                             :navData="store.layoutModelDetails['nav_pos1']?.navData"/>
                                         </slot>
                                    </template>
                            </AppTabPage>
                            </slot>
                        </template>
                        <template #tabpage9>
                            <slot name="tabpage9TabPage" :controller="controller" :store="store" :model="model" >
                            <AppTabPage 
                                name="tabpage9"
                                v-show="store.layoutModelDetails?.tabpage9?.visible"
                                :layoutModelDetails="store.layoutModelDetails">
                                    <template #view_pagecaption>
                                         <slot name="view_pagecaption" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                                         <AppPresetCaption 
                                             v-if="model.showCaption && !noViewCaption"
                                             name="view_pagecaption"
                                             @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                                             :layoutModelDetails="store.layoutModelDetails">
                                             {{model.caption}}
                                         </AppPresetCaption>
                                         </slot>
                                    </template>
                                    <template #static_label1>
                                         <slot name="static_label1" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                                         <AppPresetText 
                                             name="static_label1"
                                             @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                                             :layoutModelDetails="store.layoutModelDetails" />
                                         </slot>
                                    </template>
                                    <template #static_text4>
                                         <Panel_item_plugin v-bind="$attrs" name="static_text4" :value="store.layoutData.static_text4" :controller="controller" :store="store" />
                                    </template>
                                    <template #field_text_dynamic>
                                         <slot name="field_text_dynamic" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                                         <AppPresetText
                                             name="field_text_dynamic"
                                             :value="store.layoutData.field_text_dynamic"
                                             @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                                             :layoutModelDetails="store.layoutModelDetails"/>
                                         </slot>
                                    </template>
                            </AppTabPage>
                            </slot>
                        </template>
                </AppTabPanel>
                </slot>
            </template>
        </AppStandardContainer>
        </slot>
    </div>
</slot>
</template>
<script lang="ts" setup>
// 基于template/src/views/{{appModules}}/{{pages@DECUSTOMVIEW}}/{{spinalCase page.codeName}}-base.vue.hbs生成
import { AppCtrlPos, AppScrollContainer, AppSimpleFlexContainer, AppStandardContainer, AppTabPanel, AppTabPage } from '@components/layout-element/structure';
import Panel_item_plugin from '@plugins/editor/panel-item-plugin/panel-item-plugin.vue';
import { useProps, useBasic, useAction, useController } from './avue-testcustomview-hook';
import { IEvent, CustomViewActionType, ICustomViewAbility, ICustomViewStore, IParam } from '@/core';

// 输入参数
const props = defineProps(useProps());

// 基础数据
const { 
    model,
    getClassNames, 
    useNavParamsBind,
	useEventBind,
    handleQuickSearch,
  	handleToolbarItemClick,
    handleComponentAction,
	handleCtrlAction,
	handleCtrlInit,
	handleCtrlDestroy
} = useBasic(props);

const emit = defineEmits<{
    (event: 'view-action', name: string, action: CustomViewActionType, data: IParam[]): void;
    (event: 'view-init', name: string, data: ICustomViewAbility): void;
    (event: 'view-mounted', name: string, data: IParam): void;
    (event: 'view-destroy', name: string, data: IParam): void;
}>();

const evt = useEventBind(emit);
const classNames = computed(() => {
  	return getClassNames(props);
});

// 初始化控制器
const controller = useController(props, evt);

useNavParamsBind(controller, props);

const store: ICustomViewStore = controller.getStore();

onMounted(() => {
    controller.viewMounted();
})

onUnmounted(() => {
    controller.viewDestroy();
})
</script>
